package com.qa.clients.fallback;

import com.qa.clients.QuestionClient;
import com.qa.common.result.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;

@Slf4j
public class QuestionClientFallBackFactory implements FallbackFactory<QuestionClient> {
    /**
     * @param cause Throwable
     * @return
     */
    @Override
    public QuestionClient create(Throwable cause) {
        return new QuestionClient() {
            @Override
            public Result deleteAllQuestionsOfCategory(Long categoryId) {
                log.error("删除题目异常", cause);
                return Result.error("题目删除失败");
            }
        };
    }
}
